package com.zoo.diannaopeijian.controller;

import com.zoo.diannaopeijian.service.SysService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * 系统信息控制器
 */
@Controller
@RequestMapping("/sys")
public class SysController extends BaseController {
    @Resource
    private SysService sysService;

    @PutMapping("/logo")
    public ResponseEntity<String> logoPut(@RequestParam("logoUpload") MultipartFile logoUpload) {
        return ResponseEntity.ok(sysService.updateLogo(logoUpload) ? success : fail);
    }

    @PutMapping("/sysName")
    public ResponseEntity<String> sysNamePut(String sysName) {
        return ResponseEntity.ok(sysService.updateSysName(sysName) ? success : fail);
    }

    @GetMapping("/sysName")
    public ResponseEntity<String> getSysName() {
        return ResponseEntity.ok(sysService.getSysName());
    }
}
